<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/assets/lib/html5shiv.js"></script>
<script type="text/javascript" src="/assets/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/assets/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/assets/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/assets/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/assets/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>栏目管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	系统管理
	<span class="c-gray en">&gt;</span>
	栏目管理	
</nav>
<div class="page-container">
	<div class="text-c">
		<form action="queryItemList"  method="post">
		<input type="text" th:value="${item.name}" name="name" id="itemname" placeholder="栏目名称" style="width:250px" class="input-text">
		<input type="submit"  class="btn btn-success"  value="搜索 ">		
		</form>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
		<a class="btn btn-primary radius" onclick="system_category_add('添加栏目','itemAddPage','700','480')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加栏目</a>
		</span>
		<span class="r">共有数据：<strong th:text="${page.rowcount}"></strong> 条</span>
	</div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-hover table-bg table-sort">
			<thead>
				<tr>
					<th scope="col" colspan="9">栏目列表</th>
				</tr>
				<tr class="text-c">
										
					<th>栏目名称</th>
					<th>栏目级别</th>
					<th>上级栏目</th>
					<th>排序</th>					
					<th  width="300">操作</th>
				</tr>
			</thead>
			<tbody>
				<tr class="text-c" th:each="i : ${list}">									
					<td th:text="${i.name}" >栏目名称</td>
					<td th:if="${i.pid==0}">一级栏目</td><td th:if="${i.pid!=0}">二级栏目</td>
					<td th:if="${i.pid==0}">最高级别</td>
					<td th:if="${i.pid!=0}"><span th:text="${i.upname}"></span></td>
					<td th:text="${i.showorder}">排序</td>
					<td class="f-14"><a title="编辑" th:onclick=" 'javascript:system_category_edit(\'编辑栏目\',\'findItemById\',\'' +${i.id}+'\' );'"  style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
					<a title="删除"  th:onclick=" 'javascript:system_category_del(this, \'' +${i.id}+'\',700,480 );'"  href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
				</tr>
				
			</tbody>
		</table>
	</div>
</div>
<div th:include="page :: page" th:href=" @{queryItemList(name=${item.name})}" class="text-r pr-20" ></div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/assets/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/assets/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/assets/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/assets/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/assets/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/assets/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/assets/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">

/*系统-栏目-添加*/
function system_category_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*系统-栏目-编辑*/
function system_category_edit(title,url,id,w,h){
	var urls = url + "?id=" + id;
	layer_show(title,urls,w,h);
}
/*系统-栏目-删除*/
function system_category_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: 'deleteItemById',
			data:{"id":id},			
			dataType: 'json',
			success: function(data){				
				if(data.length>3){
					layer.msg("删除失败,请先删除下级栏目！",{icon:2,time:1000});
				}else{
					if(data>0){										
						layer.msg('删除成功!',{icon:1,time:1000}, function(){
							location.reload();
						});					
					}else{
						layer.msg('删除失败!',{icon:2,time:1000});
					}
				}
								
			},
			error:function(data) {
				console.log(data.msg);
			},
		});			
	});
}
</script>
</body>
</html>